package com.ruoyi.yljf.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.yljf.domain.Course;
import com.ruoyi.yljf.domain.enums.yljfEnums;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 首页课程VO
 * 
 * @author TC
 * @date 2025-02-19
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class HomeCourseVO {

    /** 课程id */
    private Long id;

    /** 课程名称 */
    private String name;

    /** 课程图片 */
    private String img;

    /** audio-音频/video-视频 */
    private String type;

    /** 课程是否免费(Y | N) */
    private String chargeFree;

    /** 创建时间*/
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createTime;

    /** 课程是否免费(true | false) */
    private boolean isBuy;

    public HomeCourseVO(Course course) {
        BeanUtils.copyProperties(course, this);
        this.type = yljfEnums.descOfCode(course.getType());
        this.chargeFree = yljfEnums.descOfCode(course.getChargeFree());
    }
}
